翻訳と辞書
Words near each other
・ Object process methodology
・ Object pronoun
・ Object Query Language
・ Object relations theory
・ Object request broker
・ Object resurrection
・ Object Reuse and Exchange
・ Object REXX
・ Object sexuality
・ Object skill
・ Object slicing
・ Object storage
・ Object Technology International
・ Object theory
・ Object to Be Destroyed
Object type (object-oriented programming)
・ Object Value
・ Object Windows Library
・ Object-based attention
・ Object-based language
・ Object-based spatial database
・ Object-capability model
・ Object-centered high-level reference ontology
・ Object-class detection
・ Object-code Buffer Overrun Evaluator
・ Object-modeling technique
・ Object-orientation
・ Object-oriented Abstract Type Hierarchy
・ Object-oriented analysis and design
・ Object-oriented business engineering


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Object type (object-oriented programming) : ウィキペディア英語版
Object type (object-oriented programming)


In computer science, an object type (a.k.a. wrapping object) is a datatype which is used in object-oriented programming to wrap a non-object type to make it look like a dynamic object.
Some object-oriented programming languages make a distinction between reference and value types, often referred to as objects and non-objects on platforms where complex value types don't exist, for reasons such as runtime efficiency and syntax or semantic issues. For example, Java has primitive wrapper classes corresponding to each primitive type: and , and , and , etc. Languages like C++ have little or no notion of reference type; thus, the use of object type is of little interest.
==Boxing==
Boxing, otherwise known as wrapping, is the process of placing a primitive type within an object so that the primitive can be used as a reference object. For example, lists may have certain methods which arrays might not, but the list might also require that all of its members be dynamic objects. In this case, the added functionality of the list might be unavailable to a simple array of numbers.
For a more concrete example, in Java, a can change its size, but an array must have a fixed size. One might desire to have a of s, but the class only lists references to dynamic objects — it cannot list primitive types, which are value types.
To circumvent this, s can be boxed into s, which are dynamic objects, and then added to a of s. (Using generic parameterized types introduced in J2SE 5.0, this type is represented as .)
On the other hand, C# has no primitive wrapper classes, but allows boxing of any value type, returning a generic reference.
The boxed object is always a copy of the value object, and is usually immutable. Unboxing the object also returns a copy of the stored value. Note that repeated boxing and unboxing of objects can have a severe performance impact, since it dynamically allocates new objects and then makes them eligible for Garbage collection.
There is a direct equivalence between an unboxed primitive type and a reference to an immutable, boxed object type. In fact, it is possible to substitute all the primitive types in a program with boxed object types. Whereas assignment from one primitive to another will copy its value, assignment from one reference to a boxed object to another will copy the reference value to refer to the same object as the first reference. However, this will not cause any problems, because the objects are immutable, so there is semantically no real difference between two references to the same object or to different objects (unless you look at physical equality). For all operations other than assignment, such as arithmetic, comparison, and logical operators, one can unbox the boxed type, perform the operation, and re-box the result as needed. Thus, it is possible to not store primitive types at all.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Object type (object-oriented programming)」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.